import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:responsive_grid_list/responsive_grid_list.dart';
//传递数据
typedef void TabsCallBack(String content);
class TabsText extends StatefulWidget {
  final TabsCallBack contentStrCallBack;
  List<String> datas = [];
  String title = '';
  TabsText(
      {
        required this.title,
        required this.datas,
        required this.contentStrCallBack,
        });

  @override
  _AccountEditTextState createState() => _AccountEditTextState();
}
class _AccountEditTextState extends State<TabsText> {

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        SizedBox(height: 19.h,),
        Text(widget.title,style: TextStyle(
          color: Color(0xFF333333),
          fontSize: 14.sp
        ),),
        Container(
          margin: EdgeInsets.only(top: 9.h),
          child: GridView.builder(
            physics: NeverScrollableScrollPhysics(),
            shrinkWrap: true,
            padding: EdgeInsets.all(0),
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 4, crossAxisSpacing: 6.h, mainAxisSpacing: 5.w,childAspectRatio:2.29),
            itemBuilder: (BuildContext context, int index) {
              return _items(widget.datas[index],index);
            },
            itemCount: widget.datas.length,
          ),
        )
      ],
    );
  }


  Widget _items(text,index){
    return Container(
      alignment: Alignment.center,
      height: 34.h,
      decoration: BoxDecoration(
        color: Color(0xFFF7F8FC),
        borderRadius: BorderRadius.circular(6.r),
        border: Border.all(width: 1.w,color:Color(0xFFEDEEEF) )
      ),
      child: Text(text,style: TextStyle(color: Color(0xFF333333),fontSize: 12.sp),),
    );
  }

}